<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .flex{
            background-color: gray;
            display: flex;/* 按行进行排列 */
           /*justify-content:"flex-start";靠左对齐 */
            /* justify-content: center;  居中对齐 */
            /* justify-content: flex-end;靠右对齐 */
            /* justify-content: space-between;两端对齐 */
            /* justify-content: space-evenly;分散对齐 */
            /* justify-content: space-around;左右两边的留白为平分空间的 1/2. */
            /* align-items: stretch; 垂直方向占满容器 */
            /* align-items: flex-start;靠上对齐 */
            /* align-items: center;居中对齐 */
            /* align-items: flex-end;靠下对齐 */
            /* align-items: baseline; 基线对齐 */
            /* flex-direction: column;水平对齐 */
            /* flex-direction: row-reverse;反向按行和列布局 */
            /* flex-direction: column-reverse;垂直翻转 */
            height: 200px;
        }
        .flex>*{
            flex-basis: 100px;/*行 每个子元素宽度变为了 100px 
            列模式下，flex-basis变成了高度*/
            /* width: 300px;如果再添加 width 属性，发现并不会生效 
            /*min-width 
             可以通过设置 min-width来强制设置最小宽度
            min-height
            也可以用min-height来控制最小高度*/
        }
        .flex1{
            /* width: 200px; */
            /* height: 100px; */
            border: 1px solid black;
            background-color: aqua;
            /* flex: 1; */
            /* flex-grow:1;子元素占据剩余空间的占比 */
            flex-shrink:3;
        }
        .flex2{
            width: 200px;
            /* height: 100px; */
            border: 1px solid black;
            background-color: yellow;
            font-size: 30px;
            flex-shrink:1;
            /* flex: 3;空间占比 */
        }
        .flex3{
            width: 200px;
            /* height: 100px; */
            border: 1px solid black;
            background-color: red;
        }
    </style>
</head>
<body>
    <div class="flex">
        <div class="flex1">Flex 1</div>
        <div class="flex2">Flex 2</div>
        <div class="flex3">Flex 3</div>
    </div>
</body>
</html>